package com.deyuanyun.pic.pig.controller;

import com.caixu.beanvalidateutil.imlclass.BeanValidateUtil;
import com.caixu.beanvalidateutil.imlclass.VResult;
import com.deyuanyun.pic.cache.SessionCacheSupport2;
import com.deyuanyun.pic.common.util.MyCollectionUtil;
import com.deyuanyun.pic.common.util.ajax.AjaxSupport;
import com.deyuanyun.pic.common.util.poi.ReadExcel;
import com.deyuanyun.pic.controller.dto.UserSessionVO;
import com.deyuanyun.pic.pipe.domain.exceldomain.CrossingOverInfoVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by xu on 2015/12/26.
 */
@Controller
public class TestControllerPigging extends PiggingBaseController {
    @RequestMapping("testqq.json")
    @ResponseBody
    public void test(){
        UserSessionVO sessionVO = SessionCacheSupport2.getSessionVO();
        AjaxSupport.sendSuccessText("","ss");
    }

    @RequestMapping("testp.html")
    public ModelAndView testP(){
        return forword("/test");
    }

    @RequestMapping("upExcel.html")
    public void upExcel(@RequestParam("multipartFiles")MultipartFile[] multipartFiles) throws Exception{
        //ReadExcel.readFromXls2003()
        List<CrossingOverInfoVO> xx= ReadExcel.readExcle(CrossingOverInfoVO.class,multipartFiles[0].getInputStream(),7);
        List<CrossingOverInfoVO> lll=MyCollectionUtil.removeLastEmpty(xx);
        VResult b= BeanValidateUtil.vali2(xx);
        String x="";
    }

}
